package Lib;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class ErrorLog {

	private final static String filePath = "error.log";
	
	
	public static void logError(String message){
		
		try{	
			
			FileWriter fw = new FileWriter(new File(filePath), true);
			
			Date dt = new Date();
			SimpleDateFormat df = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" );
			
			System.err.println(df.format(dt)+" :\t"+message);
			fw.write(df.format(dt)+" :\t"+message+"\r\n");
			
			fw.flush();
			fw.close();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			System.out.println("2. Block:");
			e.printStackTrace();
		}
	}
}
